﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

public class WaitNodeHandler : BaseNodeHandler
{
    public override BehaviorNodeState ExcuteNode(BehaviorEntity entity, NodeData node)
    {
        LeafNodeData data = (LeafNodeData)node;
        NumTaskData taskData = (NumTaskData)data.TaskArgs;
        taskData.CurNum += Time.deltaTime;
        if (taskData.CurNum>= taskData.TargetNum)
        {
            data.CurNodeState = BehaviorNodeState.Success;
            return data.CurNodeState;
        }
        data.CurNodeState = BehaviorNodeState.Running;
        return data.CurNodeState;
    }

    public override void ResetNode(NodeData node)
    {
        LeafNodeData data = (LeafNodeData)node;
        NumTaskData taskData = (NumTaskData)data.TaskArgs;
        taskData.CurNum =0;
    }
}